home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #1 / Amiga Plus CD - 2000 - No. 1.iso / Tools / Dev / Meshwriter / postscript.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-03  |  24.7 KB  |  651 lines

  1. /*
  2. **      $VER: postscript.c 1.00 (07.03.1999)
  3. **
  4. **      Creation date : 23.01.1999
  5. **
  6. **      Description       :
  7. **         Standart saver module for meshwriter.library.
  8. **         Saves the mesh as PostScript file.
  9. **
  10. **
  11. **      Written by Stephan Bielmann
  12. **
  13. */
  14.  
  15. /*************************** Includes *******************************/
  16.  
  17. /*
  18. ** Amiga includes
  19. */
  20. #include <dos/dos.h>
  21. #include <dos/stdio.h>
  22.  
  23. #include <clib/dos_protos.h>
  24. #include <clib/alib_stdio_protos.h>
  25.  
  26. /*
  27. ** Project includes
  28. */
  29. #include "meshwriter_private.h"
  30. #include "utilities.h"
  31.  
  32. /**************************** Defines *******************************/
  33.  
  34. // The scale to size for EPS files.
  35. #define Ci_EPSSCALETOSIZE 1000
  36.  
  37. /*********************** Type definitions ***************************/
  38.  
  39. typedef struct {
  40.     FLOAT x,y;
  41. } PSVector;
  42.  
  43. /********************** Private functions ***************************/
  44.  
  45. /********************************************************************\
  46. *                                                                    *
  47. * Name         : computebboxandscale                                 *
  48. *                                                                    *
  49. * Description  : Computes the PS bounding box and the scale factor.  *
  50. *                                                                    *
  51. * Arguments    : mesh         IN : The mesh to work with.            *
  52. *                viewtype     IN : The type of view.                 *
  53. *                scaletosize  IN : Scale ot size factor.             *
  54. *                x,y,w,h     OUT : Bounding box coordinates.         *
  55. *                scale       OUT : Scaling factor.                   *
  56. *                                                                    *
  57. *                                                                    *
  58. * Comment      :                                                     *
  59. *                                                                    *
  60. \********************************************************************/
  61. static VOID computebboxandscale(TOCLMesh *mesh,ULONG viewtype,
  62.                         ULONG scaletosize,
  63.                         TOCLFloat *x,TOCLFloat *y, TOCLFloat *w,TOCLFloat *h,
  64.                         FLOAT *scale) {
  65.  
  66.     // calculate the PS bounding box
  67.     switch(viewtype) {
  68.         case TVWTOP :
  69.         case TVWBOTTOM : {
  70.             (*x)=mesh->bBox.left;
  71.             (*y)=mesh->bBox.rear;
  72.             (*w)=mesh->bBox.right-mesh->bBox.left;
  73.             (*h)=mesh->bBox.front-mesh->bBox.rear;
  74.             break;
  75.         }
  76.  
  77.         case TVWLEFT :
  78.         case TVWRIGHT : {
  79.             (*x)=mesh->bBox.bottom;
  80.             (*y)=mesh->bBox.rear;
  81.             (*w)=mesh->bBox.top-mesh->bBox.bottom;
  82.             (*h)=mesh->bBox.front-mesh->bBox.rear;
  83.             break;
  84.         }
  85.  
  86.         case TVWFRONT :
  87.         case TVWBACK : {
  88.             (*x)=mesh->bBox.left;
  89.             (*y)=mesh->bBox.bottom;
  90.             (*w)=mesh->bBox.right-mesh->bBox.left;
  91.             (*h)=mesh->bBox.top-mesh->bBox.bottom;
  92.             break;
  93.         }
  94.  
  95.         case TVWPERSP : {
  96. //urgl !? ;-)
  97. // => projektion der bounding box auf die ebene => 2d bbox
  98.             break;
  99.         }
  100.     }
  101.  
  102.     // calculating the scaling factor
  103.     if(((*w)-(*x))>((*h)-(*y))) {
  104.         (*scale) = scaletosize/((*w)-(*x));
  105.     } else {
  106.         (*scale) = scaletosize/((*h)-(*y));
  107.     }
  108.  
  109.     // scaling the bounding box
  110.     (*x)*=(*scale),(*y)*=(*scale),(*w)*=(*scale),(*h)*=(*scale);
  111. }
  112.  
  113. /********************************************************************\
  114. *                                                                    *
  115. * Name         : writeepsheader                                      *
  116. *                                                                    *
  117. * Description  : Writes the Encapsulated PostScript header.          *
  118. *                                                                    *
  119. * Arguments    : psfile      IN : An already opened file stream.     *
  120. *                mesh        IN : Pointer to the mesh.               *
  121. *                x,y,h,w     IN : The PS bounding box.               *
  122. *                drawmode    IN : Drawing mode.                      *
  123. *                                                                    *
  124. * Return Value : RCNOERROR                                           *
  125. *                RCWRITEDATA                                         *
  126. *                                                                    *
  127. * Comment      :                                                     *
  128. *                                                                    *
  129. \********************************************************************/
  130. static ULONG writeepsheader(BPTR epsfile,TOCLMesh *mesh,TOCLFloat x,
  131.                     TOCLFloat y,TOCLFloat w,TOCLFloat h, ULONG drawmode) {
  132.  
  133.     UBYTE     buffer[100];
  134.     TOCLMaterialNode    *mat=NULL;
  135.     TOCLFloat            r,g,b;
  136.  
  137.     if (FPuts(epsfile,"%!PS-Adobe-2.0 EPSF-1.2\n%%Creator: (MeshWriterLibrary)\n")!=DOSFALSE) return(RCWRITEDATA);
  138.  
  139.     if (FPrintf(epsfile,"%%%%For: (%s)\n%%%%Title: (%s)\n",
  140.                 mesh->copyright,mesh->name)==ENDSTREAMCH) return(RCWRITEDATA);
  141.  
  142.     sprintf(buffer,"%%%%BoundingBox: %g %g %g %g\n",x,y,w,h);
  143.  
  144.     if (FPuts(epsfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  145.  
  146.     if (FPuts(epsfile,"%%EndComments\n\n%%BeginProlog\n")!=DOSFALSE) return(RCWRITEDATA);
  147.  
  148.     // write the prolog in function of the drawing mode
  149.     switch (drawmode) {
  150.         case TDMPOINTS : {
  151.             if (FPuts(epsfile,"/p {1 360 0 arcn closepath fill} bind def")!=DOSFALSE) return(RCWRITEDATA);
  152.             break;
  153.         }
  154.         case TDMGRIDBW : {
  155.             if (FPuts(epsfile,"/p {moveto lineto lineto closepath stroke} bind def")!=DOSFALSE) return(RCWRITEDATA);
  156.             break;
  157.         }
  158.         case TDMGRIDCL : {
  159.             if (FPuts(epsfile,"/p {moveto lineto lineto closepath gsave 0 setgray stroke grestore c exch get aload pop setrgbcolor} bind def\n")!=DOSFALSE) return(RCWRITEDATA);
  160.  
  161.             if(mesh->materials.firstNode!=NULL) {
  162.                 if (FPuts(epsfile,"/c [\n")!=DOSFALSE) return(RCWRITEDATA);
  163.           
  164.                 mat=mesh->materials.firstNode;
  165.                 do {
  166.                     TOCLColor col=mat->ambientColor;
  167.                     r=col.r,g=col.g,b=col.b;
  168.                     sprintf(buffer,"[%g %g %g]\n",r/255,g/255,b/255);
  169.                     if (FPuts(epsfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  170.                     mat=mat->next;
  171.                 } while(mat!=NULL);
  172.  
  173.                 if (FPuts(epsfile,"] def\n")!=DOSFALSE) return(RCWRITEDATA);
  174.             } else {
  175.                 if (FPuts(epsfile,"/c [[1 1 1]] def\n")!=DOSFALSE) return(RCWRITEDATA);
  176.             }
  177.             break;
  178.         }
  179.     }
  180.  
  181.     if (FPuts(epsfile,"\n%%EndProlog\n\n0 setgray 0 setlinecap 0.1 setlinewidth 2 setlinejoin [] 0 setdash newpath\n\n")!=DOSFALSE) return(RCWRITEDATA);
  182.  
  183.     return(RCNOERROR);
  184. }
  185.  
  186. /********************************************************************\
  187. *                                                                    *
  188. * Name         : writeepsfooter                                      *
  189. *                                                                    *
  190. * Description  : Writes the Encapsulated PostScript footer.          *
  191. *                                                                    *
  192. * Arguments    : psfile      IN : An already opened file stream.     *
  193. *                                                                    *
  194. * Return Value : RCNOERROR                                           *
  195. *                RCWRITEDATA                                         *
  196. *                                                                    *
  197. * Comment      :                                                     *
  198. *                                                                    *
  199. \********************************************************************/
  200. static ULONG writeepsfooter(BPTR epsfile) {
  201.  
  202.     if (FPuts(epsfile,"\nshowpage\n\n%%EOF\n")!=DOSFALSE) return(RCWRITEDATA);
  203.  
  204.     return(RCNOERROR);
  205. }
  206.  
  207. /********************************************************************\
  208. *                                                                    *
  209. * Name         : writepsheader                                       *
  210. *                                                                    *
  211. * Description  : Writes the PostScript header.                       *
  212. *                                                                    *
  213. * Arguments    : psfile      IN : An already opened file stream.     *
  214. *                mesh        IN : Pointer to the mesh.               *
  215. *                orientation IN : True for landscape and False for   *
  216. *                                 portrait.                          *
  217. *                dx,dy       IN : Displacemen from the origin, for   *
  218. *                                 a correct translation.             *
  219. *                                                                    *
  220. * Return Value : RCNOERROR                                           *
  221. *                RCWRITEDATA                                         *
  222. *                                                                    *
  223. * Comment      :                                                     *
  224. *                                                                    *
  225. \********************************************************************/
  226. static ULONG writepsheader(BPTR psfile,TOCLMesh *mesh,BOOL orientation,
  227.                             FLOAT dx, FLOAT dy) {
  228.     UBYTE buffer[50];
  229. //
  230. //
  231. // Noch nicht gut so, machen dass ohne eps sondern direkt portrait und
  232. // landscape output.
  233. //
  234. //
  235.  
  236.  
  237.     if (FPuts(psfile,"%!PS-Adobe-2.0\n%%Creator: (MeshWriterLibrary)\n")!=DOSFALSE) return(RCWRITEDATA);
  238.  
  239.     if (FPrintf(psfile,"%%%%For: (%s)\n%%%%Title: (%s)\n%%%%EndComments\n\n",
  240.                 mesh->copyright,mesh->name)==ENDSTREAMCH) return(RCWRITEDATA);
  241.  
  242.     if (FPuts(psfile,"initclip clippath pathbbox /DupHeight exch def /DupWidth exch def pop pop\n")!=DOSFALSE) return(RCWRITEDATA);
  243.  
  244.     if (FPuts(psfile,"save mark\n")!=DOSFALSE) return(RCWRITEDATA);
  245.  
  246.     // translating to the middle of the display
  247.     if (FPuts(psfile,"DupWidth 2 div DupHeight 2 div translate\n")!=DOSFALSE) return(RCWRITEDATA);
  248.  
  249.     // scaling according the scale to size factor
  250. //    if (FPrintf(psfile,"DupWidth DupHeight lt {DupWidth %ld div dup scale}{DupHeight %ld div dup scale}ifelse\n",
  251. //            Ci_SCALETOSIZE,Ci_SCALETOSIZE)==ENDSTREAMCH) return(RCWRITEDATA);
  252.  
  253.     // rotating according the orientation
  254.     if(orientation==TRUE) {
  255.         if (FPuts(psfile,"90 rotate\n")!=DOSFALSE) return(RCWRITEDATA);
  256.     } else {
  257.         if (FPuts(psfile,"0 rotate\n")!=DOSFALSE) return(RCWRITEDATA);
  258.     }
  259.  
  260.     // translating the displacement of the EPS origin
  261.     if(orientation==TRUE) {
  262.         sprintf(buffer,"%g %g translate\n\n",dy,dx);
  263.     } else {
  264.         sprintf(buffer,"%g %g translate\n\n",dx,dy);
  265.     }
  266.     if (FPuts(psfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  267.  
  268.     return(RCNOERROR);
  269. }
  270.  
  271. /********************************************************************\
  272. *                                                                    *
  273. * Name         : writepsfooter                                       *
  274. *                                                                    *
  275. * Description  : Writes the PostScript footer.                       *
  276. *                                                                    *
  277. * Arguments    : psfile      IN : An already opened file stream.     *
  278. *                mesh        IN : Pointer to the mesh.               *
  279. *                                                                    *
  280. * Return Value : RCNOERROR                                           *
  281. *                RCWRITEDATA                                         *
  282. *                                                                    *
  283. * Comment      :                                                     *
  284. *                                                                    *
  285. \********************************************************************/
  286. static ULONG writepsfooter(BPTR psfile) {
  287.  
  288.     if (FPuts(psfile,"\n\ncleartomark restore showpage\n%%EOF\n")!=DOSFALSE) return(RCWRITEDATA);
  289.  
  290.     return(RCNOERROR);
  291. }
  292.  
  293.  
  294. /********************************************************************\
  295. *                                                                    *
  296. * Name         : writepoints                                         *
  297. *                                                                    *
  298. * Description  : Writes all vertices of the mesh with the p macro in *
  299. *                a specific view.                                    *
  300. *                                                                    *
  301. * Arguments    : psfile      IN : An already opened file stream.     *
  302. *                mesh        IN : Pointer to the mesh.               *
  303. *                viewtype    IN : Type of view.                      *
  304. *                scale       IN : Scaling factor.                    *
  305. *                                                                    *
  306. * Return Value : RCNOERROR                                           *
  307. *                RCWRITEDATA                                         *
  308. *                                                                    *
  309. * Comment      :                                                     *
  310. *                                                                    *
  311. \********************************************************************/
  312. static ULONG writepoints(BPTR psfile,TOCLMesh *mesh,ULONG viewtype,
  313.                             FLOAT scale) {
  314.  
  315.     UBYTE                     buffer[100];
  316.     TOCLVertexNode            *ver=NULL;
  317.     TOCLVertex             v;
  318.     TOCLFloat                x,y;
  319.  
  320.       if(mesh->vertices.firstNode!=NULL) {
  321.         ver=mesh->vertices.firstNode;
  322.         do {
  323.             v=ver->vertex;
  324.  
  325.             switch(viewtype) {
  326.                 case TVWTOP : {
  327.                     x=v.x*scale,y=v.y*scale;
  328.                     break;
  329.                 }
  330.                 case TVWBOTTOM : {
  331.                     x=v.x*scale,y=-v.y*scale;
  332.                     break;
  333.                 }
  334.                 case TVWLEFT : {
  335.                     x=v.y*scale,y=v.z*scale;
  336.                     break;
  337.                 }
  338.                 case TVWRIGHT : {
  339.                     x=v.y*scale,y=-v.z*scale;
  340.                     break;
  341.                 }
  342.                 case TVWFRONT : {
  343.                     x=v.x*scale,y=v.z*scale;
  344.                     break;
  345.                 }
  346.                 case TVWBACK : {
  347.                     x=v.x*scale,y=-v.z*scale;
  348.                     break;
  349.                 }
  350.                 case TVWPERSP : {
  351.                     //urgl !? ;-)
  352.                     break;
  353.                 }
  354.             }
  355.  
  356.             sprintf(buffer,"%g %g p\n",x,y);
  357.             if(FPuts(psfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  358.             ver=ver->next;
  359.         } while(ver!=NULL);
  360.     }
  361.  
  362.     return(RCNOERROR);
  363. }
  364.  
  365. /********************************************************************\
  366. *                                                                    *
  367. * Name         : writegrid                                           *
  368. *                                                                    *
  369. * Description  : Writes the mesh as grid with the p macro in a       *
  370. *                specific view.                                      *
  371. *                                                                    *
  372. * Arguments    : psfile      IN : An already opened file stream.     *
  373. *                mesh        IN : Pointer to the mesh.               *
  374. *                viewtype    IN : Type of view.                      *
  375. *                scale       IN : Scaling factor.                    *
  376. *                colors      IN : True if with colors, else b/w.     *
  377. *                                                                    *
  378. * Return Value : RCNOERROR                                           *
  379. *                RCWRITEDATA                                         *
  380. *                                                                    *
  381. * Comment      :                                                     *
  382. *                                                                    *
  383. \********************************************************************/
  384. static ULONG writegrid(BPTR psfile,TOCLMesh *mesh,ULONG viewtype,
  385.                             FLOAT scale, BOOL colors) {
  386.  
  387.     UBYTE                         buffer[200];
  388.     TOCLPolygonNode            *pln=NULL;    
  389.     TOCLPolygonsVerticesNode    *plvi=NULL,*plv1=NULL,*plv2=NULL,*plv3=NULL;
  390.     TOCLVertex                    ver1,ver2,ver3;
  391.     TOCLFloat                    x1,y1,x2,y2,x3,y3;
  392.  
  393.  
  394.       if(mesh->polygons.firstNode!=NULL) {                 
  395.         pln=mesh->polygons.firstNode;
  396.         do {
  397.             /* Get the first point of the polygon, used to create all triangles with it */
  398.             if(pln->numberOfVertices>=3) {
  399.                 plv1=pln->firstNode;
  400.                 ver1=plv1->vertexNode->vertex;
  401.             
  402.                 plvi=plv1;
  403.                 do {    
  404.                     plv2=plvi->next;
  405.                     plv3=plv2->next;
  406.                 
  407.                     ver2=plv2->vertexNode->vertex;
  408.                     ver3=plv3->vertexNode->vertex;
  409.  
  410.                     switch(viewtype) {
  411.                         case TVWTOP : {
  412.                             x1=ver1.x*scale,y1=ver1.y*scale;
  413.                             x2=ver2.x*scale,y2=ver2.y*scale;
  414.                             x3=ver3.x*scale,y3=ver3.y*scale;
  415.                             break;
  416.                         }
  417.                         case TVWBOTTOM : {
  418.                             x1=ver1.x*scale,y1=-ver1.y*scale;
  419.                             x2=ver2.x*scale,y2=-ver2.y*scale;
  420.                             x3=ver3.x*scale,y3=-ver3.y*scale;
  421.                             break;
  422.                         }
  423.                         case TVWLEFT : {
  424.                             x1=ver1.y*scale,y1=ver1.z*scale;
  425.                             x2=ver2.y*scale,y2=ver2.z*scale;
  426.                             x3=ver3.y*scale,y3=ver3.z*scale;
  427.                             break;
  428.                         }
  429.                         case TVWRIGHT : {
  430.                             x1=ver1.y*scale,y1=-ver1.z*scale;
  431.                             x2=ver2.y*scale,y2=-ver2.z*scale;
  432.                             x3=ver3.y*scale,y3=-ver3.z*scale;
  433.                             break;
  434.                         }
  435.                         case TVWFRONT : {
  436.                             x1=ver1.x*scale,y1=ver1.z*scale;
  437.                             x2=ver2.x*scale,y2=ver2.z*scale;
  438.                             x3=ver3.x*scale,y3=ver3.z*scale;
  439.                             break;
  440.                         }
  441.                         case TVWBACK : {
  442.                             x1=ver1.x*scale,y1=-ver1.z*scale;
  443.                             x2=ver2.x*scale,y2=-ver2.z*scale;
  444.                             x3=ver3.x*scale,y3=-ver3.z*scale;
  445.                             break;
  446.                         }
  447.                         case TVWPERSP : {
  448.                             //urgl !? ;-)
  449.                             break;
  450.                         }
  451.                     }
  452.  
  453.                     sprintf(buffer,"%g %g %g %g %g %g p\n",x1,y1,x2,y2,x3,y3);
  454.                     if(colors) {
  455.                         if(pln->materialNode->index) {
  456.                             sprintf(buffer,"%ld %g %g %g %g %g %g p\n",pln->materialNode->index-1,x1,y1,x2,y2,x3,y3);
  457.                         } else {
  458.                             sprintf(buffer,"0 %g %g %g %g %g %g p\n",x1,y1,x2,y2,x3,y3);
  459.                         }
  460.                     }
  461.                     if(FPuts(psfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  462.                 
  463.                     plvi=plvi->next;
  464.                 } while(plv3->next!=NULL);    
  465.             }
  466.         
  467.             /* Get the next polygon */
  468.             pln=pln->next;            
  469.         } while(pln!=NULL);
  470.     }
  471.  
  472.     return(RCNOERROR);
  473. }
  474.  
  475. /********************************************************************\
  476. *                                                                    *
  477. * Name         : writepostscript                                     *
  478. *                                                                    *
  479. * Description  : Writes the mesh itself as PostScript ascii file.    *
  480. *                                                                    *
  481. * Arguments    : psfile   IN : An already opened file stream.        *
  482. *                mesh     IN : Pointer to the mesh.                  *
  483. *                viewtype IN : Type of view.                         *
  484. *                drawmode IN : Drawing mode.                         *
  485. *                scale    IN : Scaling factor.                       *
  486. *                                                                    *
  487. * Return Value : RCNOERROR                                           *
  488. *                RCWRITEDATA                                         *
  489. *                                                                    *
  490. * Comment      :                                                     *
  491. *                                                                    *
  492. \********************************************************************/
  493. static writepostscript(BPTR psfile,TOCLMesh *mesh,
  494.                         ULONG viewtype,ULONG drawmode, FLOAT scale) {
  495.  
  496.     
  497.  
  498. /*
  499.     switch (drawmode) {
  500.         case TDMPOINTS : {
  501.             retval=writepoints(psfile,mesh,viewtype,scale);
  502.             if(retval!=RCNOERROR) return(retval);
  503.             break;
  504.         }
  505.         case TDMGRIDBW : {
  506.             retval=writegrid(psfile,mesh,viewtype,scale,FALSE);
  507.             if(retval!=RCNOERROR) return(retval);
  508.             break;
  509.         }
  510.         case TDMGRIDCL : {
  511.             retval=writegrid(psfile,mesh,viewtype,scale,TRUE);
  512.             if(retval!=RCNOERROR) return(retval);
  513.             break;
  514.         }
  515.     }
  516. */
  517.     return(RCNOERROR);
  518. }
  519.  
  520. /********************** Public functions ****************************/
  521.  
  522. /********************************************************************\
  523. *                                                                    *
  524. * Name         : write2EPS                                           *
  525. *                                                                    *
  526. * Description  : Writes a standart Encapsulated PostScript ASCII     *
  527. *                file.                                               *
  528. *                                                                    *
  529. * Arguments    : epsfile  IN : An already opened file stream.        *
  530. *                mesh     IN : Pointer to the mesh.                  *
  531. *                viewtype IN : Type of view.                         *
  532. *                drawmode IN : Drawing mode.                         *
  533. *                                                                    *
  534. * Return Value : RCNOERROR                                           *
  535. *                RCWRITEDATA                                         *
  536. *                                                                    *
  537. * Comment      :                                                     *
  538. *                                                                    *
  539. \********************************************************************/
  540. ULONG write2EPS(BPTR epsfile,TOCLMesh *mesh,ULONG viewtype,ULONG drawmode) {
  541.  
  542.     ULONG                retval;
  543.     TOCLFloat            x,y,w,h;
  544.     FLOAT                scale;
  545.  
  546.     // get the bounding box and the scale factor
  547.     computebboxandscale(mesh,viewtype,Ci_EPSSCALETOSIZE,&x,&y,&w,&h,&scale);
  548.  
  549.     retval=writeepsheader(epsfile,mesh,x,y,w,h,drawmode);
  550.     if(retval!=RCNOERROR) return(retval);
  551.  
  552.     retval=writepostscript(epsfile,mesh,viewtype,drawmode,scale);
  553.     if(retval!=RCNOERROR) return(retval);
  554.  
  555.     retval=writeepsfooter(epsfile);
  556.  
  557.     return(RCNOERROR);
  558. }
  559.  
  560. /********************************************************************\
  561. *                                                                    *
  562. * Name         : write2PSP                                           *
  563. *                                                                    *
  564. * Description  : Writes a standart PostScript ASCII file, for a      *
  565. *                portrait visualisation, A4 portrait for example.    *
  566. *                But this one is independent of the page/display     *
  567. *                size.                                               *
  568. *                                                                    *
  569. * Arguments    : psfile   IN : An already opened file stream.        *
  570. *                mesh     IN : Pointer to the mesh.                  *
  571. *                viewtype IN : Type of view.                         *
  572. *                drawmode IN : Drawing mode.                         *
  573. *                                                                    *
  574. * Return Value : RCNOERROR                                           *
  575. *                RCWRITEDATA                                         *
  576. *                                                                    *
  577. * Comment      :                                                     *
  578. *                                                                    *
  579. \********************************************************************/
  580. ULONG write2PSP(BPTR psfile,TOCLMesh *mesh,ULONG viewtype,ULONG drawmode) {
  581. //    ULONG        retval;
  582. //    FLOAT        dx,dy;
  583. //    TOCLFloat    x,y,w,h;
  584. //    FLOAT        scale;
  585.  
  586.     // get the bounding box and the scale factor
  587. //    computebboxandscale(mesh,viewtype,Ci_PSPSCALE&x,&y,&w,&h,&scale);
  588.  
  589.     // compute the translation displacements from the origin
  590. /*    dx=x-w/2;
  591.     dy=y-h/2;
  592.  
  593.     retval=writepsheader(psfile,mesh,FALSE,dx,dy);
  594.     if(retval!=RCNOERROR) return(retval);
  595.  
  596.     retval=write2EPS(psfile,mesh,viewtype,drawmode);
  597.     if(retval!=RCNOERROR) return(retval);
  598.  
  599.     retval=writepsfooter(psfile);
  600.     if(retval!=RCNOERROR) return(retval);
  601. */
  602.     return(RCNOERROR);
  603. }
  604.  
  605. /********************************************************************\
  606. *                                                                    *
  607. * Name         : write2PSL                                           *
  608. *                                                                    *
  609. * Description  : Writes a standart PostScript ASCII file, for a      *
  610. *                landscape visualisation, A4 landscape for example.  *
  611. *                But this one is independent of the page/display     *
  612. *                size.                                               *
  613. *                                                                    *
  614. * Arguments    : psfile   IN : An already opened file stream.        *
  615. *                mesh     IN : Pointer to the mesh.                  *
  616. *                viewtype IN : Type of view.                         *
  617. *                drawmode IN : Drawing mode.                         *
  618. *                                                                    *
  619. * Return Value : RCNOERROR                                           *
  620. *                RCWRITEDATA                                         *
  621. *                                                                    *
  622. * Comment      :                                                     *
  623. *                                                                    *
  624. \********************************************************************/
  625. ULONG write2PSL(BPTR psfile,TOCLMesh *mesh,ULONG viewtype,ULONG drawmode) {
  626. //    ULONG        retval;
  627. //    FLOAT        dx,dy;
  628. //    TOCLFloat    x,y,w,h;
  629. //    FLOAT        scale;
  630.  
  631.     // get the bounding box and the scale factor
  632. //    computebboxandscale(mesh,viewtype,&x,&y,&w,&h,&scale);
  633.  
  634.     // compute the translation displacements from the origin
  635. /*    dx=x-w/2;
  636.     dy=y-h/2;
  637.  
  638.     retval=writepsheader(psfile,mesh,TRUE,dx,dy);
  639.     if(retval!=RCNOERROR) return(retval);
  640.  
  641.     retval=write2EPS(psfile,mesh,viewtype,drawmode);
  642.     if(retval!=RCNOERROR) return(retval);
  643.  
  644.     retval=writepsfooter(psfile);
  645.     if(retval!=RCNOERROR) return(retval);
  646. */
  647.     return(RCNOERROR);
  648. }
  649.  
  650. /************************* End of file ******************************/
  651.